package com.example.shilehui;


import cn.jhc.service.EnlistService;
import cn.jhc.utils.Strings;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

public class EnlistFillInfoGenderActivity extends Activity {
	
	
	private TextView _titleTextView;
	private ImageView _backImageView;
	private TextView _titleRightTextView;
	private ImageView _titleRightImageView;
	private String _title;
	private TextView _maleTextView;
	private TextView _femaleTextView;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		super.onCreate(savedInstanceState);
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		Intent intent=getIntent();
		_title=intent.getStringExtra(Strings.ENLIST_FILL_TITLE);
		ini();
		
	}
	
	private void ini(){
		
		setContentView(R.layout.enlist_fill_info_gender_layout);
		_maleTextView=(TextView)findViewById(R.id.enlist_male_textview);
		_femaleTextView=(TextView)findViewById(R.id.enlist_female_textview);
		_maleTextView.setOnClickListener(new onViewClickListener());
		_femaleTextView.setOnClickListener(new onViewClickListener());
		
		setTitleStyle();
		
	}
	
	private void setTitleStyle(){
		 
		 _titleTextView=(TextView)findViewById(R.id.title_middle);
		 _backImageView=(ImageView)findViewById(R.id.title_left_imageview);
		 _titleRightTextView=(TextView)findViewById(R.id.title_right_textview);
		 _titleRightImageView=(ImageView)findViewById(R.id.title_right_imageview);

		 _titleTextView.setText(_title);
		 _titleTextView.setTextColor(Color.WHITE);
		 _titleTextView.setTextSize(18);
		 _titleTextView.setGravity(Gravity.CENTER); 
		 _backImageView.setImageResource(R.drawable.left_icon);
		 _backImageView.setOnClickListener(new onViewClickListener());
		 _titleRightImageView.setVisibility(View.GONE);
		 _titleRightTextView.setVisibility(View.GONE);
		 
		 
	}
	
	
	private class onViewClickListener implements OnClickListener{

		@Override
		public void onClick(View v) {
			switch(v.getId()){
				case R.id.title_left_imageview:
					finish();
					break;
				case R.id.enlist_male_textview:
					
					EnlistService.getInstance().setGender(getResources().getString(R.string.male));
					
					finish();
					break;
				case R.id.enlist_female_textview:
					
					EnlistService.getInstance().setGender(getResources().getString(R.string.female));
					finish();
					break;
			}
			
		}
		 
	}
	
	

}
